<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible"
      content="ie=edge">
    <title>Document</title>
</head>
<style>
    #modal {
        height: 200px;
        width: 200px;
        line-height: 200px;
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        border: 1px solid black;
        text-align: center;
    }
</style>
<body>

</body>
<script>
    const Modal = (() => {
        let modal
        return () => {
            if (!modal) {
                modal = document.createElement('div')
                modal.id = 'modal'
                modal.style.display = 'none'
                document.body.appendChild(modal)
            }

        }
    })()
    class OpenButton {
        onClick () {
            const modal = new Modal()
            modal.style.display = 'block'
        }
    }

    class Decorator {
        constructor (open_button) {
            this.aaa='xxx'
            this.open_button = open_button
        }

        onClick () {
            this.open_button.onClick()
        }
    }
</script>
</html>
